package company.baidu;

import java.util.Scanner;

public class BD3 {

    static int count = 0;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int m = sc.nextInt();
        int n = sc.nextInt();
        helper(m, n, 0, 0, 0);
        System.out.println(count);
    }

    private static void helper(int m, int n, int index, int step1, int step2) {
        if (index >= m) {
            if (index == m)
                count++;
            return;
        }
        for (int i = 1; i <= n; i++) {
            if (i != step1 && i != step2)
                helper(m, n, index + i, step2, i);
        }
    }
}
